<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>
    <!-- Title -->
    {% if Title %}
    <title>{{ Title }} - Cloud Driver</title>
    {% else %}
    <title>Welcome to Cloud Driver</title>
    {% endif %}

    <!-- Bootstrap -->
<link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" type="text/css" rel="stylesheet"/>
<script src="{{ url_for('static', filename='js/jquery.min.js') }}" type="text/javascript"></script>
<script src="{{ url_for('static', filename='js/bootstrap.min.js') }}" type="text/javascript"></script>
<script>
    $SCRIPT_ROOT={{ request.script_root|tojson|safe }};
</script>
</head>
<body style="padding-top: 60px">

<nav class="navbar navbar-default navbar-fixed-top">
    <div class="container-fluid container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navtop" aria-expanded="false">
                <span class="sr-only">收起/展开</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="{{ url_for('index') }}">Cloud Driver</a>
        </div>

        <div class="collapse navbar-collapse" id="navtop">
            <div class="navbar-form navbar-left">
                <div class="form-group">
                    <input id="pathInput" type="text" class="form-control" placeholder="路径">
                </div>
                <button type="submit" class="btn btn-default" onclick="GoToPath()">路径直达</button>
            </div>

            <script type="text/javascript">
                function GoToPath(){
                    path = $('#pathInput').val()
                    $(location).attr('href', 'index?path='+path)
                }
            </script>

            <ul class="nav navbar-nav navbar-right">
                {% if not current_user or current_user.is_authenticated == False  %}
                    <li><a href="{{ url_for('login') }}"> Log In </a></li>
                    <li><a href="{{ url_for('register') }}"> Register </a></li>
                {% else %}
                    <li><a href="{{ url_for('logout') }}"> Log Out </a></li>
                {% endif %}
            </ul>
        </div>
    </div>
</nav>

<div class="container">
    {% with messages = get_flashed_messages() %}
    {% if messages %}
    {% for message in messages %}
        <div class="alert alert-info">
            <p>{{ message }}</p>
        </div>
    {% endfor %}
        <hr />
    {% endif %}
    {% endwith %}
</div>

<div class="container">
    {% block content %}

    {% endblock %}
</div>
</body>
</html>
